-- ======================================================================
-- Hell Lua Bus
-- 
-- Copyright 2012-2013Hell-Prototypes
--
-- http://www.hellprototypes.com/
--
-- This is free software, licensed under the terms of the GNU General
-- Public License as published by the Free Software Foundation.
-- ======================================================================
hlb = require('libhlb')

function device_open()
	local ret = hlb.usb_open()
	if ret < 0 then
		print("Fail to open usb device")
		return false
	end
	
	return true
end

function device_close()
	local ret = hlb.usb_close()
	if ret < 0 then
		print("Fail to close usb device")
		return false
	end
	
	return true
end
-- -----------------------------------------------
--[[
local file = io.open("led_test.xsvf", "rb")--led_test.xsvf
local content = file:read("*all")
file:close()

print("type of content is : " .. type(content))

for i=1, content:len() do
    io.write(string.format("%02xH ", content:byte(i)):upper())
    if i%16 == 0 then
    	print("")
    end
end
--]]

--[[
device_open()

io.write("\r\nAny key to close device ...")
io.flush()
io.read()
print("")

device_close()
--]]
